// ValidationAspects
// Written by Mike Saunders
// Released under Microsoft Public License (Ms-PL)
using System;
using ValidationAspects.Factories;
using ValidationAspects.Sdk;

namespace ValidationAspects
{
	[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	public sealed class LengthInRangeAttribute : ValidatorAttribute
	{
		private readonly int _minimum;
		private readonly int _maximum;

		public LengthInRangeAttribute(int minimum, int maximum)
		{
			_minimum = minimum;
			_maximum = maximum;
		}

		#region Overrides of ValidatorAttribute
		public override IValidatorFactory Factory
		{
			get { return new LengthInRange {Minimum = _minimum, Maximum = _maximum}; }
		}
		#endregion
	}
}